<template>
  <div class="app">
    <h3>我是App组件（祖组件）</h3>
    <Suspense>
      <template v-slot:default>
        <child-com/>
      </template>
      <template v-slot:fallback>
        <h3>稍等，加载中。。。</h3>
      </template>
    </Suspense>
  </div>
</template>

<script>
// import ChildCom from "@/components/ChildCom.vue"; // 静态引入

import {defineAsyncComponent} from "vue"; // 异步引入
const ChildCom = defineAsyncComponent(() => import('./components/ChildCom.vue'))

export default {
  name: 'App',
  components: {ChildCom}
}
</script>

<style>
.app {
  background-color: gray;
  padding: 10px;
}
</style>
